import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:material_collection_app/widget/common/underline_indicator.dart';

class TabBarCustom extends StatelessWidget {
  final List tabs;
  final EdgeInsets indicatorInsets;
  final TabController tabController;

  TabBarCustom({
    Key key,
    @required this.tabs,
    this.indicatorInsets = const EdgeInsets.fromLTRB(16, 0, 16, 0),
    this.tabController
  })
  : super(key: key);
  
  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: false);

    return Theme(
      data: ThemeData(
        splashColor: Colors.transparent,
        highlightColor: Colors.transparent,
      ),
      child: TabBar(
        controller: tabController,
        indicator: UnderlineIndicator(
          insets: indicatorInsets
        ),
        indicatorSize: TabBarIndicatorSize.label, 
        unselectedLabelColor: Colors.white,
        labelStyle: TextStyle(
          fontSize: 36.w, 
          fontWeight: FontWeight.bold
        ), 
        unselectedLabelStyle: TextStyle(
          fontSize: 14, 
          fontWeight: FontWeight.w500
        ),
        tabs: tabs.map((text) => Tab(text: text)).toList(),
      )
    );
  }
}